<script>
    $("#bodyView").removeClass("background");
    $("#bodyView").removeClass("news_background");
    $("#bodyView").removeClass("achievement_background");
    $("#bodyView").addClass("edituser_background");
</script>
<div class="container">
    <div class="row">
        <!--col-md-3 垂直导航栏-->
        <div class="col-md-3">
            <ul class="nav nav-pills nav-stacked">
                <li ng-class="{'active':tabIndex==0}" ng-click="switchTabTo0()"><a class="text-center">修改头像</a></li>
                <li ng-class="{'active':tabIndex==1}" ng-click="switchTabTo1()"><a href="" class="text-center">个人信息</a></li>
                <li ng-class="{'active':tabIndex==2}" ng-click="switchTabTo2()"><a href="" class="text-center">重置密码</a></li>
                <!--社团成员-->
                <li ng-class="{'active':tabIndex==3}" ng-click="switchTabTo3()" ng-if="user.role==2||user.role==3"><a href="" class="text-center">个人成果</a></li>
                <!--管理员-->
                <li ng-class="{'active':tabIndex==4}" ng-click="switchTabTo4()" ng-if="user.role==3"><a href="" class="text-center">个人新闻</a></li>
                <hr>
                <li ng-click="back()"><a href="" class="text-center">返回</a></li>
            </ul>
        </div>
        <!--col-md-3 垂直导航栏-->
        <!--tab0-->
        <div class="col-md-8" ng-show="tabIndex == 0">
            <fieldset nv-file-drop="" uploader="uploader" filters="queueLimit, customFilter">
                <legend class="text-center">上传头像</legend>
                <div class="text-center">
                    <img style="width: 300px;height: 300px;" src="{{user.headimage}}" class="img-circle">
                    <br>
                    <br>
                    <form id="submitImg">
                        <input type="file" nv-file-select="" uploader="uploader" class="form-control input-lg" accept="image/*"/>
                    </form>
                        <div class="col-md-12" style="margin-bottom: 40px">
                            <table class="table">
                                <thead>
                                <tr>
                                    <th width="50%">Name</th>
                                    <th ng-show="uploader.isHTML5">Size</th>
                                    <th ng-show="uploader.isHTML5">Progress</th>
                                    <th>Status</th>
                                    <th>Actions</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr ng-repeat="item in uploader.queue">
                                    <td><strong>{{ item.file.name }}</strong></td>
                                    <td ng-show="uploader.isHTML5" nowrap>{{ item.file.size/1024/1024|number:2 }} MB</td>
                                    <td ng-show="uploader.isHTML5">
                                        <div class="progress" style="margin-bottom: 0;">
                                            <div class="progress-bar" role="progressbar" ng-style="{ 'width': item.progress + '%' }"></div>
                                        </div>
                                    </td>
                                    <td class="text-center">
                                        <span ng-show="item.isSuccess"><i class="glyphicon glyphicon-ok"></i></span>
                                        <span ng-show="item.isCancel"><i class="glyphicon glyphicon-ban-circle"></i></span>
                                        <span ng-show="item.isError"><i class="glyphicon glyphicon-remove"></i></span>
                                    </td>
                                    <td nowrap>
                                        <button type="button" class="btn btn-success btn-xs" ng-click="item.upload()" ng-disabled="item.isReady || item.isUploading || item.isSuccess">
                                            <span class="glyphicon glyphicon-upload"></span> 上传
                                        </button>
                                        <button type="button" class="btn btn-warning btn-xs" ng-click="item.cancel()" ng-disabled="!item.isUploading">
                                            <span class="glyphicon glyphicon-ban-circle"></span> 取消
                                        </button>
                                        <button type="button" class="btn btn-danger btn-xs" ng-click="item.remove()">
                                            <span class="glyphicon glyphicon-trash"></span> 移除
                                        </button>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                </div>
            </fieldset>
        </div>
        <!--tab0-->
        <!--tab1-->
        <div class="col-md-8" ng-show="tabIndex == 1">
            <div>
                <form>
                    <fieldset>
                        <legend class="text-center">编辑用户</legend>
                        <div class="form-group">
                            <span class="hint">用户名(必填):</span>
                            <input readonly required type="text" name="username" class="form-control input-lg" placeholder="账号" ng-model="user.username">
                        </div>
                        <div class="form-group">
                            <span class="hint">昵称(必填):</span>
                            <input required type="text" name="cardnum" class="form-control input-lg" placeholder="昵称" ng-model="user.nickname">
                        </div>
                        <div class="form-group">
                            <span class="hint">邮箱(必填):</span>
                            <input ng-change="checkEmail()" required type="email" class="form-control input-lg" placeholder="邮箱" ng-model="user.email">
                            <span class="help-block" style="color: red;" ng-if="emailError==1">请填写正确的邮箱<span class="glyphicon glyphicon-warning-sign"></span></span>
                        </div>
                        <div class="form-group">
                            <span class="hint">手机号(必填):</span>
                            <input required type="text" class="form-control input-lg" placeholder="手机号码" ng-model="user.mobile" ng-change="checkPhoneLength()" >
                            <span class="help-block" style="color: red;" ng-if="mobileError==1">请输入正确的手机号<span class="glyphicon glyphicon-warning-sign"></span></span>
                        </div>
                        <div class="form-group">
                            <span class="hint">真实姓名(必填):</span>
                            <input required type="text" name="realname" class="form-control input-lg" placeholder="真实姓名" ng-model="user.realname">
                        </div>
                        <div class="form-group" ng-if="isShow">
                            <span class="hint">用户状态(必填):</span>
                            <br>
                            <div class="btn-group">
                                <label class="btn btn-danger" ng-model="user.user_isuse" uib-btn-radio="false">禁用</label>
                                <label class="btn btn-success" ng-model="user.user_isuse" uib-btn-radio="true">启用</label>
                            </div>
                        </div>
                        <div class="form-group" ng-if="isShow">
                            <span class="hint">用户身份(必填):</span>
                            <select class="form-control" ng-model="user.role">
                                <option value="0" ng-selected="user.role==0">暂未认证</option>
                                <option value="1" ng-selected="user.role==1">非社团成员</option>
                                <option value="2" ng-selected="user.role==2">社团成员</option>
                                <option value="3" ng-selected="user.role==3">管理员</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <br>
                            <button style="width:280px" class="btn btn-primary btn-lg" type="submit" ng-click="updateUser()" ng-disabled="myform.$invalid">修改</button>
                            <button style="width:280px;float: right;" class="btn btn-default btn-lg" type="submit" ng-click="reset()">重置</button>
                        </div>
                    </fieldset>
                </form>
            </div>
        </div>
        <!--tab1-->
        <!--tab2-->
        <div class="col-md-8" ng-show="tabIndex == 2">
            <fieldset>
                <legend class="text-center">重置密码</legend>
                <div class="form-group">
                    <span class="hint">新密码:</span>
                    <input type="password" name="password" class="form-control input-lg" placeholder="新密码" ng-model="newpwd" ng-change="checkPassLength()">
                    <span class="help-block" style="color: red;" ng-if="passwordError==1">密码长度不能小于6位<span class="glyphicon glyphicon-warning-sign"></span></span>
                </div>
                <div class="form-group">
                    <span class="hint">重复密码:</span>
                    <input type="password" name="repeat" uib-popover-html="htmlPopover"  popover-trigger="none" popover-is-open="isOpen" ng-blur="checkPwd()" popover-placement="top-left"  class="form-control input-lg" placeholder="重复密码" ng-model="repeatpwd">
                </div>
                <div class="form-group">
                    <br>
                    <button class="btn btn-primary btn-lg btn-block" type="submit" ng-click="updatePwd()">修改</button>
                </div>
            </fieldset>
        </div>
        <!--tab2-->
        <!--tab3-->
        <div class="col-md-8" ng-show="tabIndex == 3">
            <fieldset>
                <legend class="text-center" ng-if="user.role==2||user.role==3">已发表的成果</legend>
                <div class="alert alert-info text-center" role="alert" ng-if="totalNum==0&&(user.role==2||user.role==3)">您还没有发表任何成果哟~</div>
                <div class="row">
                    <div class="col-sm-6 col-md-3" ng-repeat="achievement in achievements" ng-if="user.role==2||user.role==3">
                        <div class="thumbnail">
                            <img ng-src="{{achievement.headimage}}" alt="{{achievement.nickname}}" style="width: inherit;" class="img-rounded img-responsive">
                            <div class="caption">
                                <h3>{{achievement.achievement_title}}</h3>
                                <p>发表于：{{achievement.achievement_publish_time}}</p>
                                <p>
                                    <a href="javascript:void(0)" class="btn btn-primary" role="button" ng-click="editAchievement(achievement.achievement_id)">编辑</a>
                                    <a href="javascript:void(0)" class="btn btn-danger" role="button" ng-click="deleteAchievement(achievement.achievement_id)">删除</a>
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row text-center">
                    <uib-pagination previous-text="上一页" next-text="下一页" first-text="首页" last-text="尾页" ng-change="achievementChangePage()" items-per-page="{{itemsPerPage}}" total-items="achievementTotalNum" ng-model="achievementCurrentPage" max-size="maxSize" class="pagination-md" boundary-links="true" rotate="false"></uib-pagination>
                </div>
            </fieldset>
        </div>
        <!--tab3-->
        <!--tab4-->
        <div class="col-md-8" ng-show="tabIndex == 4">
            <fieldset>
                <legend class="text-center" ng-if="user.role==3">已发表的新闻</legend>
                <div class="alert alert-info text-center" role="alert" ng-if="totalNum==0&&user.role==3">您还没有发表任何新闻哟~</div>
                    <div class="row">
                        <div class="col-sm-6 col-md-3" ng-repeat="news in newses" ng-if="user.role==3">
                            <div class="thumbnail">
                                <img ng-src="{{news.headimage}}" alt="{{news.nickname}}" style="width: inherit;" class="img-rounded img-responsive">
                                <div class="caption">
                                    <h3>{{news.news_title}}</h3>
                                    <p>发表于：{{news.news_publish_time}}</p>
                                    <p>
                                        <a href="javascript:void(0)" class="btn btn-primary" role="button" ng-click="editNews(news.news_id)">编辑</a>
                                        <a href="javascript:void(0)" class="btn btn-danger" role="button" ng-click="deleteNews(news.news_id)">删除</a>
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div>
                <div class="row text-center">
                    <uib-pagination previous-text="上一页" next-text="下一页" first-text="首页" last-text="尾页" ng-change="newsChangePage()" items-per-page="{{itemsPerPage}}" total-items="newsTotalNum" ng-model="newsCurrentPage" max-size="maxSize" class="pagination-md" boundary-links="true" rotate="false"></uib-pagination>
                </div>
            </fieldset>
        </div>
        <!--tab4-->
    </div>
</div>